package com.crazy.bookstore.task;

import com.crazy.bookstore.service.BookService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author: 卢辉宇
 * @date: 2022/12/31 22:29
 * @description:
 */
@Component
public class ComputeTask {

    @Resource
    BookService bookService;

    /*每个整分钟响应一次的定时器*/
    @Scheduled(cron="0 * * * * ?")
    public void task(){
        System.out.println("定时更新总评分数");
        bookService.updateScore();

    }
}
